< previous page page_261 next page >

Page 261
Adding Records
To add a new record to a table using the data control, you need to set the EOFAction property to a value other than the default.
EXERCISE
Adding New Records at Runtime
1. Set the EOFAction property to 2-adDoAddNew.
2. Run the project again.
3. Click the Move Last button to move to the last record. Click once on the Move Next button to move to the phantom record. You should now have a blank screen in which to add a new record.
4. Add another employee to this form.
5. Click the Move First button to save the newly added record.
6. Click the Move Last button to see the new record.
analysis.gifThe Data Control allows you to add new records on-the-fly just by setting a property.

Summary
Using the ADO data control allows you to create database applications with very little effort. Using just a few properties and some code, you can make a complete add, edit, and delete data entry form. There are many data-aware controls that automatically interact with the data controljust by you setting some properties. Data-bound combo boxes, list boxes, and grid controls further round out your ability to create very nice database interfaces with very little coding.
Review Questions
1. Which property do you click to bring up the property pages for a data control?
2. What two properties must you set on each text box to have the data control automatically fill in field information?
3. Which control would you use if you had to display multiple columns?

 
< previous page page_261 next page >

If you like this book, buy it!